<?php

include_once 'dbinfo.php';


$username=$_POST['username'];
$passwd=$_POST['passwd'];
$cellphone=$_POST['cellphone'];
$photo=$_FILES['photo']['tmp_name'];
$originname=$_FILES['photo']['name'];

$filename=md5($photo).$originname;

move_uploaded_file($photo,'../img/'.$filename);

$link = mysqli_connect($dbhost,$dbusername,$dbpassword,$dbname,$dbport);
if(!$link){
    die("连接失败");
}

$sql = "update tb_user set passwd='$passwd',avatar='$filename',cellphone='$cellphone' where username='$username'";

mysqli_query($link,$sql) or die('fail');


mysqli_close($link);

echo 'ok';


?>
